# -*- coding:utf-8 -*-
# __author__ : "张百科"
# Date: 2021/1/26 16:09
# File: goods.py
# IDE: PyCharm

from rest_framework import serializers
from models.goods import Goods

class GoodsSerializer(serializers.ModelSerializer):
    brand_id = serializers.IntegerField(required=True,label='品牌',help_text='品牌')
    category_id = serializers.IntegerField(required=True,label='分类',help_text='分类')
    goods_sn = serializers.CharField(required=True,label='商品序列号',help_text='商品序列号')
    goods_name = serializers.CharField(required=True, label='商品名字',help_text='商品名字')
    sell_volume = serializers.IntegerField(required=False, label='库存',help_text='库存')
    is_on_sale = serializers.IntegerField(read_only=True)
    goods_brief = serializers.CharField(required=False,label='商品简介',help_text='商品简介')
    goods_desc = serializers.CharField(required=False,label='商品详情',help_text='商品详情')
    list_pic_url = serializers.CharField(required=False)
    index_pic_url = serializers.CharField(required=False)
    goods_unit = serializers.CharField(required=False)
    is_top = serializers.IntegerField(read_only=True)


    class Meta:
        model = Goods
        exclude = ('is_delete',)